//HUD daorinha do wb

//esconde o hud normal
function EscondeHUD( name )
	if (name == "CHudHealth" or name == "CHudBattery" or name == "CHudAmmo" or name == "CHudSecondaryAmmo") then
		return false
	end
end
hook.Add( "HUDShouldDraw", "HideAll", EscondeHUD )
//esconde o hud normal

local showIntelInfo = false

function RINTEL (P, key)
	if key == IN_RELOAD then
		showIntelInfo = true
	end
end
hook.Add( "KeyPress", "intelInfoHook", RINTEL )

function RRINTEL (P, key)
	if key == IN_RELOAD then
		showIntelInfo = false
	end
end
hook.Add( "KeyRelease", "intelInfoHookrelease", RRINTEL )

function DrawHUD()
    //paintPlMarkers() --OTIMIZAR!!!
	
	if LocalPlayer():Alive() then
	
	surface.SetDrawColor(255, 255, 255, 255)
	
	// hud basico vida
	local tex = surface.GetTextureID("sprites/heart") -- 161 X 179
	surface.SetTexture(tex)
	surface.DrawTexturedRect(5, ScrH()-(161*0.5)-12, 161*0.5, 179*0.5)
	draw.SimpleTextOutlined( tostring(LocalPlayer():Health()), "Trebuchet24", 45, ScrH()-52.5, Color(255,255,255,255), 1, 1, 1, Color(0,0,0,255) )
	end
	
	//intel icons
	local sf = 0.32
	if showIntelInfo then
	local intel = surface.GetTextureID("sprites/al_intel_icon") -- 500 X 200
	surface.SetDrawColor(255, 255, 255, 255)
	surface.SetTexture(intel)
	surface.DrawTexturedRect(4, 4, 500*(sf+0.04), 200*sf)
	draw.SimpleTextOutlined( LocalPlayer():GetNWInt("al_intel"), "HUDNumber5", 130, 35, Color(255,255,255,255), 1, 1, 1, Color(0,0,0,255) )
	
	local intel2 = surface.GetTextureID("sprites/rb_intel_icon") -- 500 X 200
	surface.SetDrawColor(255, 255, 255, 255)
	surface.SetTexture(intel2)
	surface.DrawTexturedRect(ScrW()-(500*(sf+0.04))+16, 4, 500*sf, 200*sf)
	draw.SimpleTextOutlined( LocalPlayer():GetNWInt("rb_intel"), "HUDNumber5", ScrW() - 120, 35, Color(255,255,255,255), 1, 1, 1, Color(0,0,0,255) )
	end
	
	//tempo
	local time = surface.GetTextureID("sprites/timer") -- 400 X 90
	surface.SetTexture(time)
	local seconds = tostring( math.floor( (GetConVar( "wb_round_time" ):GetInt() - LocalPlayer():GetNWInt("TimeLeft",0)) ) ).." s"
	surface.DrawTexturedRect(ScrW()/2 - (400*0.65)/2, 0, 400*0.65, 90*0.65)
	draw.RoundedBox( 4, (ScrW()/2)-(256/2), 2, ((GetConVar( "wb_round_time" ):GetInt()-LocalPlayer():GetNWInt("TimeLeft",0))/GetConVar( "wb_round_time" ):GetInt())*256, 14, Color( 255, 160, 40, 180 ) )
	draw.SimpleTextOutlined( seconds , "DefaultBold", (ScrW()/2), 9, Color(255,255,255,255), 1, 1, 1, Color(0,0,0,255) )

end
hook.Add("HUDPaint", "DrawWarballsHud", DrawHUD)



//pinta o player marker --OTIMIZAR!!!
/*function paintPlMarkers()
      for k,v in pairs(ents.FindByClass("player")) do
	
	local pos = v:GetPos() + Vector(0,0,90)
	
	cam.Start3D(EyePos(),EyeAngles())
	if v:Team() == 1 then
	render.SetMaterial(Material("sprites/rebel_marker"))
	else
	render.SetMaterial(Material("sprites/alianca_marker"))
    end
	
	alphaColor = LocalPlayer():GetPos():Distance(pos)
	if alphaColor > 500 then alphaColor = 500 end
	if v:Alive() and v != LocalPlayer() then
	render.DrawSprite( pos, 16, 16, Color(255,255,255,((500-alphaColor)/500)*255))
	end
	cam.End3D()
	end--for
	
end*/